package ${config.package_serviceImpl};


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ${config.package_dao}.${table.class_name}${config.suffix_dao};
import ${config.package_entity}.${table.class_name}${config.suffix_entity};
import ${config.package_service}.${table.class_name}${config.suffix_service};

/**
 * <#if table.annotation??>${table.annotation}</#if>service实现类
 * @author ${config.author}
 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
 */
@Service
public class ${table.class_name}${config.suffix_serviceImpl} implements ${table.class_name}${config.suffix_service} {
	

    @Autowired
    private ${table.class_name}${config.suffix_dao} ${StringUtil.firstFiledLower(table.class_name)}${config.suffix_dao};
    
	/**
	 * 创建<#if table.annotation??>${table.annotation}</#if>
	 * @param ${StringUtil.firstFiledLower(table.class_name)}
	 * @return
	 */
	@Override
	public void create${table.class_name}(${table.class_name}${config.suffix_entity} ${StringUtil.firstFiledLower(table.class_name)}){
		${StringUtil.firstFiledLower(table.class_name)}${config.suffix_dao}.insert${table.class_name}(${StringUtil.firstFiledLower(table.class_name)});
	}
	
	/**
	 * 更新<#if table.annotation??>${table.annotation}</#if>
	 * @param ${StringUtil.firstFiledLower(table.class_name)}
	 * @return
	 */
	@Override
	public void update${table.class_name}(${table.class_name}${config.suffix_entity} ${StringUtil.firstFiledLower(table.class_name)}){
		${StringUtil.firstFiledLower(table.class_name)}${config.suffix_dao}.update${table.class_name}(${StringUtil.firstFiledLower(table.class_name)});
	}
	
	/**
	 * <#if table.annotation??>${table.annotation}</#if>列表
	 * @return
	 */
	@Override
	public List<${table.class_name}${config.suffix_entity}> find${table.class_name}List(){
		return ${StringUtil.firstFiledLower(table.class_name)}${config.suffix_dao}.select${table.class_name}List();
	}
	
	/**
	 * <#if table.annotation??>${table.annotation}</#if>详情
	 * @param id 主键id
	 * @return
	 */
	@Override
	public ${table.class_name}${config.suffix_entity} find${table.class_name}(Integer ${table.primary_key_field}){
		return ${StringUtil.firstFiledLower(table.class_name)}${config.suffix_dao}.select${table.class_name}(${table.primary_key_field});
	}


}
